<template>
    <div>
        <div class='header'>管理平台</div>
        <div class='container'>
            <div class='sider'>
                <div :class="['sider-item',{ active : current === 'a'}]"
                @click="to('a')">Cart</div>
                <div :class="['sider-item',{ active : current === 'b'}]"
                 @click="to('b')">TodoList</div>
                <div :class="['sider-item',{ active : current === 'c'}]"
                 @click="to('c')">AdvanceTodoList</div>
            </div>
            <div class='content'>
                <router-view></router-view>
            </div>
        </div>
    </div>
</template>

<script>
export default {
  data() {
    return {
      current: this.$route.name,
    };
  },
  methods: {
    to(v) {
      if (this.$route.path !== `/main/${v}`) {
        this.current = v;
        this.$router.push(v);
      }
    },
  },

};

</script>

<style lang="scss" scoped>
    .container{
        display:flex;
        height: calc(100vh - 60px);
        width: 100%;
        background-color: rgb(255, 249, 159);
    }
    .header{
        height: 60px;
        background: linear-gradient(110deg,#000000, #363636, #646363);
        text-align: center;
        line-height: 60px;
        color:beige;
        font-weight: bold;
    }
    .sider{
        width: 200px;
        background: linear-gradient(145deg,#aef4a0, #9ee7f7, #ffe5c6);
        height:100%;
    }
    .content{
        //flex = 1 =======>
        // flex-basis = 0（basis实际决定元素的宽度（%/px）） && flex-grow = 1(膨胀) && flex-shrink = 1（收缩）
        flex:1;
        background-color: rgb(224, 224, 224);
    }
    .sider-item{
        width: 100%;
        height: 50px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding:20px;
        cursor: pointer;
        font-size: 20px;
        color:rgb(137, 137, 137)
    }
    .active{
        background-color: rgb(140, 184, 252);
        color:rgb(65, 65, 65);
        font-weight: bold;
    }
</style>
